<?php


namespace app\service;


class RedisQueueService
{
    private $redis;
    public function __construct()
    {
        $this->redis = new \Redis();
        $this->redis->connect('127.0.0.1',6379);
        $this->redis->auth("123456");
        $this->redis->select(1);
    }

    public function push($key, $value, $type = 'end')
    {
        $ret = FALSE;
        if ($type == 'end') {
            $ret = $this->redis->rpush($key, $value);
        } else if ($type == 'start') {
            $ret = $this->redis->lpush($key, $value);
        }
        return $ret;
    }

}